///////////////////////////////////////////////////////////
//  IntData.cpp
//  Implementation of the Class IntData
//  Created on:      19-Aug-2013 10:11:13 PM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#include "IntData.h"
#include "DataSchemaXML.h"
#include <sstream>

using namespace Data;


IntData::IntData(const int& _value)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::INT_T;
  this->m_value = _value;
}


IntData::IntData(const IntData& anotherInt)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::INT_T;
  this->m_value = anotherInt.m_value;
}


IntData::~IntData()
{

}


IData::DataType IntData::GetDataType() const 
{

	return this->m_dataType;
}


IObject::ObjectType IntData::GetType() const 
{

	return this->m_type;
}


int IntData::GetValue() const 
{

	return this->m_value;
}


void IntData::SetValue(const int& _value)
{
  this->m_value = _value;
}


IObject* IntData::Clone()
{
  IntData* cloneData = new IntData(*this);
	return cloneData;
}


String_t IntData::ToString() const 
{
  StringStream_t result;
  //result << L"value = " << this->m_value << std::endl;
  result << this->m_value;
  return result.str();
}


String_t IntData::ToXML()
{
  //<UseInteger>0</UseInterger>
  StringStream_t xml;
  xml << _T("<") << DataSchemaXML::INTDATA_ELEMENT << _T(">") << this->m_value << _T("</") << DataSchemaXML::INTDATA_ELEMENT << _T(">");
  return xml.str();
}

bool IntData::operator==( const int& _anotherValue ) const
{
  return this->m_value == _anotherValue;
}

bool IntData::operator!=( const int& _anotherValue ) const
{
  return this->m_value != _anotherValue;
}

bool IntData::operator>( const int& _anotherValue ) const
{
  return this->m_value > _anotherValue;
}

bool IntData::operator>=( const int& _anotherValue ) const
{
  return this->m_value >= _anotherValue;
}

bool IntData::operator<( const int& _anotherValue ) const
{
  return this->m_value < _anotherValue;
}

bool IntData::operator<=( const int& _anotherValue ) const
{
  return this->m_value <= _anotherValue;
}
